home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / admin / squota-0.02 / Squota.tar / Squota / Squotaday < prev   
Text File  |  1996-05-13  |  2KB  |  40 lines

  1. #!/bin/bash
  2. # Squota - Screwed Quota                Copyright (c) 1996 Gary Barrueto
  3. #=============================================================================
  4. # Squotaday - This one adds the total at the end of each day and logs it
  5. #=============================================================================
  6. # Load varibles
  7. #=============================================================================
  8.  
  9. . /var/adm/Squota/quotavars
  10.  
  11. #=============================================================================
  12. # Start from the first user listed on /var/adm/Squota/quota.users
  13. #=============================================================================
  14.  
  15. while test $EMPTY != $PULENGTH
  16. do
  17.   EMPTY=`expr $EMPTY + 1`
  18.  
  19. #=============================================================================
  20. # Get the users name
  21. #=============================================================================
  22.  
  23.   USERSHOME=`head -$EMPTY $HQ/quota.users | tail -1`
  24.     if test -d $WHATDIR/$USERSHOME
  25.       then
  26.  
  27. #============================================================================
  28. # echo out daily totals, format with sed to make " " to " + " to use w/ expr
  29. #============================================================================
  30.  
  31.     FSTOTAL=`echo \`cat $HQ/$USERSHOME.$MON\`  | sed 's/ / + /g'`
  32.  
  33. #============================================================================
  34. # use expr to do math, then divide today with # of days...
  35. #============================================================================
  36.  
  37.         echo $DAY$USERSHOME `expr \( $FSTOTAL \) / $DAY` / `expr $FSLIMIT \* 1024`K >> $HQ/quota.daily.$MON
  38.     fi
  39. done
  40.